<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
	</head>
	<body>
		<div id="app">
			{{message}}
			<h1>v-bind指令</h1>
			<h2>绑定到src属性</h2>
			<img v-bind:src="imgSrc" alt="" v-on:click="change"/>
			<a v-bind:[attributename]="url">链接地址</a>
			
			<form v-bind="formObj">
				<input type="text" />
			</form>
		</div>
		
		<script>			
			var app = Vue.createApp({
				data(){
					return {
						message: "Hello World!",
						attributename: "href",
						url: "https://www.baidu.com",
						imgSrc: "../../pics/yes.png",
						fileName: "yes.png",
						formObj: {
							mehtod: "post",
							action: "#"
						}
					}
				},
				methods:{
					change:function(){
						if(this.imgSrc == "../../pics/yes.png"){
							this.imgSrc = "../../pics/no.png";
						}else{
							this.imgSrc = "../../pics/yes.png";
						}
					}
				}
			});
			var vm = app.mount("#app")
		</script>
	</body>
</html>
